home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 4 / Amiga Tools 4.iso / tools / wb-enhancement / bangermenu / bangermonitorid.asm < prev    next >
Assembly Source File  |  1996-02-13  |  6KB  |  274 lines

  1. ;Programm: BangerMonitorID gibt bei der angewählten Auflösung die ID-Nummer aus
  2. ;   Autor: Andre´ Trettin
  3. ;Codename: Banger
  4. ;   Begin: 13-Dez-95 20:27:34
  5. ;    $VER: BangerMonitorID.asm 1.3 (20-Dez-95)
  6.  
  7. ** INCLUDE Struktur Variablen
  8. * Fehler Codes: 21=kein Speicher
  9. *               22=konnte Library (oder Libraries) nicht öffnen
  10. *               23=konnte Fenster nicht öffnen
  11. *               24=kein Speicher für ScreenModeRequester
  12. *               25=kein PubScreen vorhanden (Wo ist die Workbench)
  13.  
  14.     incdir  INCLUDE:
  15.     include exec/exec.i
  16.     include exec/io.i
  17.     include dos/dos.i
  18.     include dos/dosextens.i
  19.     include intuition/intuition.i
  20.     include utility/utility.i
  21.     include libraries/asl.i
  22.     include lvo/exec_lib.i
  23.     include lvo/intuition_lib.i
  24.     include lvo/asl_lib.i
  25.     include lvo/graphics_lib.i
  26.     include lvo/utility_lib.i
  27.  
  28.     STRUCTURE Internal,0
  29.     APTR    INTUIBase
  30.     APTR    GFXBase
  31.     APTR    ASLBase
  32.     APTR    UTILBase
  33.     APTR    MyScreenReq
  34.     APTR    WindowHandle
  35.     APTR    ScreenHandle
  36.     APTR    WBenchMsg
  37.     STRUCT  EndeReqTxt,[64]
  38.     LABEL   Int_SIZEOF
  39. ;;
  40. ** Hauptprog
  41.     moveq   #0,d7
  42.     move.l  4.w,a6
  43.     move.l  #Int_SIZEOF,d0
  44.     move.l  #MEMF_PUBLIC!MEMF_CLEAR,d1
  45.     jsr     _LVOAllocMem(a6)
  46.     move.l  d0,a5
  47.     bne.s   WorkBench
  48.     moveq   #21,d7           ;21 = kein Speicher
  49.     bra.s   Ende
  50. WorkBench
  51.     suba.l  a1,a1
  52.     jsr     _LVOFindTask(a6)
  53.     move.l  d0,a4
  54.     tst.l   pr_CLI(a4)
  55.     bne.s   fromCLI
  56.     lea     pr_MsgPort(a4),a0
  57.     jsr     _LVOWaitPort(a6)
  58.     lea     pr_MsgPort(a4),a0
  59.     jsr     _LVOGetMsg(a6)
  60.     move.l  d0,WBenchMsg(a5)
  61. fromCLI
  62.     bsr.w   LibOeffne
  63.     tst.b   d7
  64.     bne.s   SchliesseLibrary
  65.     bsr.w   PubScreenHolen
  66.     tst.b   d7
  67.     bne.s   SchliesseLibrary
  68.     bsr.w   OeffneFenster
  69.     tst.b   d7
  70.     bne.s   PubScreenSchliesse
  71.     bsr.s   ASLScreenAsk
  72.     bsr.w   FensterSchliesse
  73. PubScreenSchliesse
  74.     bsr.w   PubScreenAbgeben
  75. SchliesseLibrary
  76.     bsr.w   LibSchliesse
  77.     tst.l   WBenchMsg(a5)
  78.     beq.s   NOWBench
  79.     move.l  4.w,a6
  80.     jsr     _LVOForbid(a6)
  81.     move.l  WBenchMsg(a5),a1
  82.     jsr     _LVOReplyMsg(a6)
  83.     jsr     _LVOPermit(a6)
  84. NOWBench
  85.     move.l  a5,a1
  86.     move.l  #Int_SIZEOF,d0
  87.     jsr     _LVOFreeMem(a6)
  88. Ende
  89.     move.l  d7,d0
  90.     rts
  91. ;;
  92. ** ASLScreenAsk
  93. ASLScreenAsk
  94.     move.l  ASLBase(a5),a6
  95.     moveq   #ASL_ScreenModeRequest,d0
  96.     suba.l  a0,a0
  97.     jsr     _LVOAllocAslRequest(a6)
  98.     move.l  d0,MyScreenReq(a5)
  99.     bne.s   ScreenReqOK
  100.     moveq   #24,d7
  101.     bra.s   ScreenReqEnde
  102. ScreenReqOK
  103.     move.l  d0,a0
  104.     lea     ScreenASLTags(pc),a1
  105.     lea     TitleReq(pc),a2
  106.     move.l  a2,4(a1)
  107.     jsr     _LVOAslRequest(a6)
  108.     tst.l   d0
  109.     beq.s   ScreenFreeReq
  110.     move.l  MyScreenReq(a5),a2
  111.     move.l  sm_DisplayID(a2),d6
  112.     lea     EndeReqTxt(a5),a1
  113.     lea     EndeReqVor(pc),a0
  114. CopyTxtLoop
  115.     move.b  (a0)+,(a1)+
  116.     cmp.b   #10,-1(a0)
  117.     bne.s   CopyTxtLoop
  118.     move.l  #'    ',(a1)+
  119.     move.l  UTILBase(a5),a6
  120.     bsr.s   LongHex2Dez
  121.     move.l  WindowHandle(a5),a0
  122.     lea     EndeReq(pc),a1
  123.     lea     EndeReqTi(pc),a2
  124.     move.l  a2,8(a1)
  125.     lea     EndeReqTxt(a5),a2
  126.     move.l  a2,12(a1)
  127.     lea     EndeReqGad(pc),a2
  128.     move.l  a2,16(a1)
  129.     suba.l  a2,a2
  130.     suba.l  a3,a3
  131.     move.l  INTUIBase(a5),a6
  132.     jsr     _LVOEasyRequestArgs(a6)
  133. ScreenFreeReq
  134.     move.l  ASLBase(a5),a6
  135.     move.l  MyScreenReq(a5),a0
  136.     jsr     _LVOFreeAslRequest(a6)
  137. ScreenReqEnde
  138.     rts
  139. ;;
  140. ** LongHex2Dez
  141. *################
  142. * d6=HexZahl
  143. * a1=Buffer für DezZahl in Ascii
  144. * a6=UtilityBase
  145. *################
  146. *   d0=zwischenspeicher von d6
  147. *   d1=TeilerZahl
  148. *   d2=Zählschleife
  149. *   d3=Führende Null Status
  150. *   a0=Teileraddresse
  151. LongHex2Dez
  152.     moveq   #0,d3
  153.     lea     DiviFkt(pc),a0
  154.     moveq   #10-1,d2
  155.     move.l  d6,d0
  156. HexZahlloop
  157.     move.l  (a0)+,d1
  158.     jsr     _LVOUDivMod32(a6)
  159.     tst.w   d0
  160.     bne.s   keineNull
  161.     tst.b   d3
  162.     beq.s   naechsteZahl
  163. keineNull
  164.     add.b   #'0',d0
  165.     move.b  d0,(a1)+
  166.     moveq   #1,d3
  167. naechsteZahl
  168.     move.l  d1,d0
  169.     dbra    d2,HexZahlloop
  170.     rts
  171. ;;
  172. ** OeffneFenster
  173. OeffneFenster
  174.     move.l  INTUIBase(a5),a6
  175.     lea     Fenster_Tags(pc),a1
  176.     lea     ScreenTitle(pc),a0
  177.     move.l  a0,4(a1)
  178.     move.l  ScreenHandle(a5),12(a1)
  179.     suba.l  a0,a0
  180.     jsr     _LVOOpenWindowTagList(a6)
  181.     move.l  d0,WindowHandle(a5)
  182.     bne.s   WindowOK
  183.     moveq   #23,d7
  184. WindowOK
  185.     rts
  186. FensterSchliesse
  187.     move.l  INTUIBase(a5),a6
  188.     move.l  WindowHandle(a5),a0
  189.     jsr     _LVOCloseWindow(a6)
  190.     rts
  191. ;;
  192. ** PubScreenHolen
  193. PubScreenHolen
  194.     move.l  INTUIBase(a5),a6
  195.     suba.l  a0,a0
  196.     jsr     _LVOLockPubScreen(a6)
  197.     move.l  d0,ScreenHandle(a5)
  198.     bne.s   PubScreenOK
  199.     moveq   #25,d7
  200. PubScreenOK
  201.     rts
  202. PubScreenAbgeben
  203.     move.l  INTUIBase(a5),a6
  204.     suba.l  a0,a0
  205.     move.l  ScreenHandle(a5),a1
  206.     jsr     _LVOUnlockPubScreen(a6)
  207.     rts
  208. ;;
  209. ** Library Öffnen + Schliessen
  210. LibOeffne
  211.     move.l  a5,a4
  212.     lea     intname(pc),a1
  213.     bsr.s   OeffneLib
  214.     lea     gfxname(pc),a1
  215.     bsr.s   OeffneLib
  216.     lea     aslname(pc),a1
  217.     bsr.s   OeffneLib
  218.     lea     utilname(pc),a1
  219.     bsr.s   OeffneLib
  220.     rts
  221. OeffneLib
  222.     moveq   #37,d0
  223.     jsr     _LVOOpenLibrary(a6)
  224.     move.l  d0,(a4)+
  225.     beq.s   LibError
  226.     rts
  227. LibError
  228.     moveq   #22,d7                   ;22 = konnte Library nicht öffnen
  229.     rts
  230. LibSchliesse
  231.     move.l  4.w,a6
  232.     moveq   #4-1,d2
  233.     lea     MyScreenReq(a5),a4
  234. SchliesseLib
  235.     move.l  -(a4),a1
  236.     cmp.l   #0,a1
  237.     beq.s   notOpened
  238.     jsr     _LVOCloseLibrary(a6)
  239. notOpened
  240.     dbra    d2,SchliesseLib
  241.     rts
  242. ;;
  243. ** LONG Daten
  244. Fenster_Tags
  245.     dc.l    WA_ScreenTitle,0
  246.     dc.l    WA_PubScreen,0
  247.     dc.l    WA_Top,100
  248.     dc.l    WA_Left,200
  249.     dc.l    WA_Width,200
  250.     dc.l    WA_Height,125
  251.     dc.l    WA_Flags,WFLG_SMART_REFRESH!WFLG_BACKDROP!WFLG_BORDERLESS
  252.     dc.l    TAG_DONE
  253. ScreenASLTags
  254.     dc.l    ASLSM_TitleText,0
  255.     dc.l    TAG_DONE
  256. EndeReq
  257.     dc.l    EasyStruct_SIZEOF
  258.     dc.l    0,0,0,0
  259. DiviFkt
  260.     dc.l    1000000000,100000000,10000000,1000000,100000,10000,1000,100,10,1
  261. ;;
  262. ** BYTE Daten
  263. intname         INTUITIONNAME
  264. gfxname         GRAFNAME
  265. aslname         ASLNAME
  266. utilname        UTILITYNAME
  267. EndeReqVor      dc.b    'The MonitorID is:',10
  268. EndeReqTi       dc.b    'MonitorID',0
  269. EndeReqGad      dc.b    'Super|Oh,no!',0
  270. TitleReq        dc.b    'BangerMonitorID',0
  271.                 dc.b    '$VER: '
  272. ScreenTitle     dc.b    'BangerMonitorID 1.3 (20-Dec-95) © by Andre´ Trettin',0
  273. ;;
  274.